﻿using Abp.Domain.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WanFang.Test
{
    public class Material : Entity
    {
        public virtual string Name { get; set; }
        public virtual string FNumber { get; set; }
        public virtual string Batch { get; set; }
        public virtual ICollection<JianCe> JianCes { get; set; }
    }

    /// <summary>
    /// 检测项目主表，用来存放检测项目数据
    /// </summary>
    [Table("JianCe")]
    public class JianCe : Entity
    {
        [ForeignKey("Material_Id")]
        public virtual Material Material { get; set; }
        public virtual int Material_Id { get; set; }
        /// <summary>
        /// 检验日期
        /// </summary>
        public virtual DateTime JianCeDate { get; set; }
        /// <summary>
        /// 供方名称
        /// </summary>
        public virtual string Supplier { get; set; }
        /// <summary>
        /// 检验结果
        /// </summary>
        public virtual bool JianCeResult { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public virtual string Description { get; set; }
        public virtual ICollection<JianCeItem> JianCeItems { get; set; }
    }
    /// <summary>
     /// 检测项目子表，用来存放检测项目数据
     /// 该表字段动态添加
     /// </summary>
    [Table("JianCeItem")]
    public class JianCeItem : Entity
    {
        [ForeignKey("JianCe_Id")]
        public virtual JianCe JianCe { get; set; }
        public virtual int JianCe_Id { get; set; }
    }

    /// <summary>
    /// 检测项目模板（根据模板生成界面）
    /// </summary>
    [Table("JianCeTemplate")]
    public class JianCeTemplate : Entity
    {
        [ForeignKey("Material_Id")]
        public virtual Material Material { get; set; }
        public virtual int Material_Id { get; set; }

        /// <summary>
        /// 检测项目名称
        /// </summary>
        public virtual string Name { get; set; }
        /// <summary>
        /// 说明
        /// </summary>
        public virtual string Description { get; set; }
        /// <summary>
        /// 字段类型
        /// </summary>
        public virtual string FieldCategory { get; set; }
        /// <summary>
        /// JianCeItem表对应的数据库字段名称
        /// </summary>
        public virtual string FField { get; set; }
        /// <summary>
        /// 该字段对应的表，默认用JianCeItem
        /// </summary>
        public virtual string FTable { get; set; }

        public JianCeTemplate()
        {
            this.FTable = "JianCeItem";
        }

    }
}
